// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   PieDataSerie.java

package com.java4less.rchart;

import com.java4less.rchart.gc.ChartColor;
import com.java4less.rchart.gc.ChartFont;
import com.java4less.rchart.gc.GraphicsProvider;
import java.util.Vector;

// Referenced classes of package com.java4less.rchart:
//			DataSerie, FillStyle

public class PieDataSerie extends DataSerie
{

	double total;
	public ChartColor valueColor;
	public ChartFont valueFont;
	public double textDistanceToCenter;
	public boolean drawPercentages;
	Vector Styles;
	Vector itemsTogether;
	Vector itemsLabel;

	public PieDataSerie()
	{
		total = 0.0D;
		valueColor = GraphicsProvider.getColor(ChartColor.BLACK);
		valueFont = GraphicsProvider.getFont("Arial", ChartFont.PLAIN, 10);
		textDistanceToCenter = 1.0D;
		drawPercentages = true;
		Styles = new Vector(0, 2);
		itemsTogether = new Vector(0, 2);
		itemsLabel = new Vector(0, 2);
	}

	public PieDataSerie(double y[], FillStyle s[], boolean keepTogether[], String labels[])
	{
		total = 0.0D;
		valueColor = GraphicsProvider.getColor(ChartColor.BLACK);
		valueFont = GraphicsProvider.getFont("Arial", ChartFont.PLAIN, 10);
		textDistanceToCenter = 1.0D;
		drawPercentages = true;
		Styles = new Vector(0, 2);
		itemsTogether = new Vector(0, 2);
		itemsLabel = new Vector(0, 2);
		String label = "";
		boolean together = true;
		for (int i = 0; i < y.length; i++)
		{
			label = "";
			together = true;
			if (labels != null && labels.length > i)
				label = labels[i];
			if (keepTogether != null && keepTogether.length > i)
				together = keepTogether[i];
			addPieData(y[i], s[i], together, label);
		}

	}

	public PieDataSerie(double y[], FillStyle s[])
	{
		total = 0.0D;
		valueColor = GraphicsProvider.getColor(ChartColor.BLACK);
		valueFont = GraphicsProvider.getFont("Arial", ChartFont.PLAIN, 10);
		textDistanceToCenter = 1.0D;
		drawPercentages = true;
		Styles = new Vector(0, 2);
		itemsTogether = new Vector(0, 2);
		itemsLabel = new Vector(0, 2);
		for (int i = 0; i < y.length; i++)
			addPieData(y[i], s[i]);

	}

	public void addPieData(double y, FillStyle s)
	{
		yData.addElement(new Double(y));
		total = total + y;
		Styles.addElement(s);
		itemsTogether.addElement(new Boolean(true));
	}

	public void addPieData(double y, FillStyle s, boolean keepTogether, String label)
	{
		yData.addElement(new Double(y));
		total = total + y;
		Styles.addElement(s);
		itemsTogether.addElement(new Boolean(keepTogether));
		if (label != null)
			itemsLabel.addElement(label);
		else
			itemsLabel.addElement("");
	}
}
